/*  File Name	: Poker.h
 *  Author		: Javie Pong
 *	 E-mail		: 823960168@qq.com
 *  Created on	: 2012-8-5
 *  Description:
 */

#ifndef POKER_H_
#define POKER_H_

#include <map>
#include <vector>
#include <string>
#define ONE_MAX

#ifdef ONE_MAX
#define MAX_CARD CARD_ONE
#else
#define MAX_CARD CARD_K
#endif

const std::string CardName[4][13]={
		{"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","DJ","DQ","DK"},
		{"C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","CJ","CQ","CK"},
		{"H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","HJ","HQ","HK"},
		{"S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","SJ","SQ","SK"}};

enum CARDTYPE
{
	CARDTYPE_NONE		= 0,
	CARDTYPE_DIAMOND 	= 1,//diamond 红砧
	CARDTYPE_CLUB 		= 2,//club黑梅,
	CARDTYPE_HEART 		= 3,//heart红心
	CARDTYPE_SPADE 		= 4 //Spade 黑桃
};

enum CARDNUMBER
{
	CARD_NONE		= 0,

#ifdef ONE_MAX
	CARD_ONE		= 14,	//-->1
#else
	CARD_ONE		= 1,	//-->1
#endif
	CARD_TWO 		= 2,	//-->2
	CARD_THREE 		= 3,	//-->3
	CARD_FOUR 		= 4,	//-->4
	CARD_FIVE 		= 5,	//-->5
	CARD_SIX 		= 6,	//-->6
	CARD_SEVEN 		= 7,	//-->7
	CARD_EIGHT 		= 8,	//-->8
	CARD_NINE 		= 9,	//-->9
	CARD_TEN		= 10,	//-->10
	CARD_J			= 11,	//-->J
	CARD_Q			= 12,	//-->Q
	CARD_K			= 13	//-->K
};

class Card
{
public:
	Card(int p=0);
	virtual ~Card();
	void set_info(CARDTYPE type,CARDNUMBER num,std::string name);
	void reset(void);

	CARDNUMBER number_;
	CARDTYPE type_;
	std::string name_;
	bool is_used_;
	bool is_public_card_;//是否是公共牌
};

typedef std::vector<Card*> CardVec;

class Table;

class Poker
{
public:
	Poker(int p=0);

	virtual ~Poker();

	void reset(void);

	int init(Table *table);

	int shuffle_poker(void);

	int card_index(int card_num);

	CardVec &card_vec(void);

private:
	Poker(Poker &);

	Poker operator=(Poker&);

	CardVec card_vec_;

	Table *table_;
};

#endif /* POKER_H_ */
